import request from '../../utils/request.js'
const state={
	initData:'Vuex的测试数据',
	indexData:{}, //主页的数据
}
const actions={
	async getIndexDataAction(context){
		// 执行异步任务
		let result=await request('/getTndexData')
		// 触发mutation，同时将异步数据交给mutation
		context.commit('changeIndexDataMutation',result)
	}
}
const mutations={
	changeIndexDataMutation(state,indexData){
		// 同步修改状态数据
		state.indexData=indexData
	}
}
const getters={
	
}

export default{
	state,
	actions,
	mutations,
	getters
}